Skip to content

feat: implement Browse AI plugin against official v2 API - #1042

Merged
devjain32 merged 4 commits into
corsairdev:mainfrom
TanayGurav19:feat/browserai-plugin
Aug 27, 2026
Merged

feat: implement Browse AI plugin against official v2 API#1042
devjain32 merged 4 commits into
corsairdev:mainfrom
TanayGurav19:feat/browserai-plugin

Conversation

@TanayGurav19

@TanayGurav19 TanayGurav19 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

Adding Browseai Plugin For corsair.

Closes #1040

Checklist

Before submitting your PR, please verify the following:

  • I have run pnpm lint and all checks pass
  • I have run pnpm typecheck and there are no TypeScript errors
  • I have run pnpm build and all packages build successfully
  • I have run pnpm test and all tests pass
  • I have added or updated tests where applicable
  • I have added or updated necessary documentation

Screenshots / Demos (if applicable)

Screenshot 2026-08-27 at 4 07 14 AM

Additional Notes

Summary by CodeRabbit

  • New Features
    • Added Browse AI integration with API-key authentication.
    • Added support for checking status, managing robots and tasks, running jobs, configuring monitors, and managing webhooks.
    • Added validation for Browse AI requests and responses.
    • Added Browse AI as a supported provider with typed configuration.
  • Bug Fixes
    • Improved handling of authentication, permissions, missing resources, invalid requests, and rate limits.
    • Prevented retries for write operations to avoid duplicate actions.
  • Tests
    • Added comprehensive coverage for requests, endpoints, schemas, authentication, and error handling.

@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the corsair Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 06bc963e-6787-497f-a095-1c516961573c

📥 Commits

Reviewing files that changed from the base of the PR and between d05846e and 8098a6f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • packages/browseai/client.test.ts
  • packages/browseai/client.ts
  • packages/browseai/endpoints.test.ts
  • packages/browseai/endpoints/ops.ts
  • packages/browseai/endpoints/shared.ts
  • packages/browseai/error-handlers.test.ts
  • packages/browseai/error-handlers.ts
  • packages/corsair/core/constants.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Adds a new Browse AI Corsair provider with versioned schemas, authenticated v2 API requests, endpoint operations, audit logging, error handling, package configuration, and automated tests.

Changes

Browse AI provider

Layer / File(s) Summary
Browse AI schemas and endpoint contracts
packages/browseai/schema/..., packages/browseai/endpoints/types.ts, packages/browseai/schema.test.ts
Adds Browse AI entity schemas, endpoint input and output validators, inferred types, registries, and schema tests.
HTTP transport and error handling
packages/browseai/client.ts, packages/browseai/client.test.ts, packages/browseai/error-handlers.ts, packages/browseai/error-handlers.test.ts, packages/browseai/endpoints/shared.ts
Adds schema-validated requests, method-specific retry behavior, HTTP error classification, compact request helpers, and retry tests.
Endpoint operations and audit flow
packages/browseai/endpoints/..., packages/browseai/endpoints.test.ts
Adds status, robot, task, monitor, and webhook operations with encoded paths, compact payloads, typed responses, audit events, and request tests.
Provider registration and package wiring
packages/browseai/index.ts, packages/browseai/plugin.test.ts, packages/browseai/package.json, packages/browseai/jest.config.cjs, packages/browseai/tsconfig.json, packages/browseai/tsup.config.ts, packages/corsair/core/constants.ts
Registers the Browse AI provider, authentication, endpoint metadata, schemas, package build settings, and provider constants. Tests cover operation registration and API-key resolution.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 8098a

This PR adds the Browse AI plugin and has no actionable merge-blocking risk remaining based on the supplied evidence; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant CorsairPlugin
  participant EndpointOperation
  participant browseaiCall
  participant makeBrowseaiRequest
  participant BrowseAIAPI
  CorsairPlugin->>EndpointOperation: Invoke typed operation
  EndpointOperation->>browseaiCall: Validate input and pass schema
  browseaiCall->>makeBrowseaiRequest: Pass API key and request options
  makeBrowseaiRequest->>BrowseAIAPI: Send v2 HTTP request
  BrowseAIAPI-->>makeBrowseaiRequest: Return JSON response or HTTP error
  makeBrowseaiRequest-->>browseaiCall: Return parsed result or error
  browseaiCall-->>EndpointOperation: Return typed result
  EndpointOperation-->>CorsairPlugin: Log completed audit event
Loading

Suggested reviewers: dhirenderchoudhary

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 17 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: implementing a Browse AI plugin for the official v2 API.
Linked Issues check ✅ Passed The PR implements the requested BrowseAI integration with data-analysis operations across system, robot, task, monitor, and webhook resources. It also includes webhook support through create and list …
Out of Scope Changes check ✅ Passed The changes are consistent with the BrowseAI integration objective in issue #1040. The client, schemas, endpoint handlers, error handling, tests, package configuration, and provider registration suppo…
Full details: Linked Issues check

Explanation

The PR implements the requested BrowseAI integration with data-analysis operations across system, robot, task, monitor, and webhook resources. It also includes webhook support through create and list operations, satisfying issue #1040.

Full details: Out of Scope Changes check

Explanation

The changes are consistent with the BrowseAI integration objective in issue #1040. The client, schemas, endpoint handlers, error handling, tests, package configuration, and provider registration support the requested plugin and webhook functionality.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the core Changes in packages/corsair label Aug 24, 2026
@Dhirenderchoudhary
Dhirenderchoudhary self-requested a review August 24, 2026 16:09
@Dhirenderchoudhary Dhirenderchoudhary self-assigned this Aug 25, 2026
@Dhirenderchoudhary Dhirenderchoudhary changed the title feat: add BrowserAI plugin scaffold feat: add Browseai plugin Aug 26, 2026
@Dhirenderchoudhary Dhirenderchoudhary changed the title feat: add Browseai plugin feat: implement Browse AI plugin against official v2 API Aug 26, 2026
@Dhirenderchoudhary
Dhirenderchoudhary marked this pull request as ready for review August 26, 2026 22:44
@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a Browse AI provider plugin backed by the official v2 API.

  • Implements API-key authentication and typed operations for status, robots, tasks, monitors, and webhooks.
  • Validates endpoint inputs and API responses with Zod schemas.
  • Prevents automatic replay of non-idempotent write requests while retaining rate-limit handling for safe operations.
  • Adds package configuration and endpoint, transport, schema, authentication, and error-handling tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported output-validation bypass and non-idempotent write replay have both been addressed.

Important Files Changed

Filename Overview
packages/browseai/client.ts Implements authenticated v2 requests, method-sensitive rate-limit retries, and runtime response parsing.
packages/browseai/endpoints/ops.ts Implements the Browse AI endpoint operations with input validation, output schemas, and audit logging.
packages/browseai/endpoints/types.ts Defines the input and output contracts registered for all exposed operations.
packages/browseai/error-handlers.ts Classifies provider HTTP failures while disabling framework-level operation replay.
packages/browseai/index.ts Registers authentication, endpoints, schemas, metadata, permissions, and error handlers for the plugin.
packages/browseai/schema/database.ts Defines the Browse AI entities and nested response data structures.
packages/corsair/core/constants.ts Registers Browse AI among the core supported plugin identifiers.

Sequence Diagram

sequenceDiagram
    participant App as Corsair application
    participant Plugin as Browse AI plugin
    participant Client as Browse AI client
    participant API as Browse AI v2 API
    App->>Plugin: Invoke typed endpoint
    Plugin->>Plugin: Parse input schema
    Plugin->>Client: Request with endpoint output schema
    Client->>API: Bearer-authenticated HTTP request
    API-->>Client: JSON response
    Client->>Client: Parse output schema
    Client-->>Plugin: Validated result
    Plugin-->>App: Typed response
Loading

Reviews (2): Last reviewed commit: "chore: merge main into feat/browserai-pl..." | Re-trigger Greptile

Comment thread packages/browseai/client.ts Outdated
Comment thread packages/browseai/error-handlers.ts
@github-actions

Copy link
Copy Markdown

Plugin PR scorecard — packages/browseai

Check Status Notes
R1 — Scope: plugin files only
R2 — Tests with assertions
R3 — Description complete
R3 — Linked issue / claim
R4 — Demo video / recording

Rules: PLUGIN_PR_RULES.md · re-runs on every push

@github-actions

Copy link
Copy Markdown

Hey @TanayGurav19, thanks for the contribution! 🏴‍☠️ Before a maintainer reviews, please fix the items below — the review re-runs automatically on your next push.

Must fix

  • P1 packages/browseai/client.ts:62Output validation is bypassed
    When Browse AI returns data that differs from the declared output schema, makeBrowseaiRequest returns the unchecked generic response and the runtime does not parse the registered schema, causing callers to receive malformed data as the declared TypeScript type.

Rule Used: Every endpoint must validate inputs and outputs wi... (source)

Knowledge Base Used: Provider plugin implementation conventions

  • P1 packages/browseai/error-handlers.ts:30Retries replay write operations
    When a write continues receiving HTTP 429 after the client exhausts its three retries, this handler retries the entire endpoint up to five more times, causing one logical request to send roughly two dozen non-idempotent writes and potentially create duplicate tasks, monitors, bulk runs, or webhooks.

Knowledge Base Used: Provider plugin implementation conventions

If anything remains after your next push, a maintainer will take it from there and do the final review and merge.

@github-actions github-actions Bot added the bot:round-1 Review bot posted consolidated findings label Aug 26, 2026
@Dhirenderchoudhary

Copy link
Copy Markdown
Collaborator

@greptile

@github-actions

Copy link
Copy Markdown

Maintainer review needed

Automated rounds are exhausted. Remaining findings:

  • P1 packages/browseai/client.tsOutput validation is bypassed
    When Browse AI returns data that differs from the declared output schema, makeBrowseaiRequest returns the unchecked generic response and the runtime does not parse the registered schema, causing callers to receive malformed data as the declared TypeScript type.

Rule Used: Every endpoint must validate inputs and outputs wi... (source)

Knowledge Base Used: Provider plugin implementation conventions

  • P1 packages/browseai/error-handlers.ts:33Retries replay write operations
    When a write continues receiving HTTP 429 after the client exhausts its three retries, this handler retries the entire endpoint up to five more times, causing one logical request to send roughly two dozen non-idempotent writes and potentially create duplicate tasks, monitors, bulk runs, or webhooks.

Knowledge Base Used: Provider plugin implementation conventions

@github-actions github-actions Bot added the needs-maintainer Automated rounds exhausted - human review needed label Aug 26, 2026

@Dhirenderchoudhary Dhirenderchoudhary left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM tested locally

@devjain32
devjain32 merged commit 7bcbe38 into corsairdev:main Aug 27, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:round-1 Review bot posted consolidated findings core Changes in packages/corsair needs-maintainer Automated rounds exhausted - human review needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browseai

3 participants